package com.example.demo.dao;

import com.example.demo.entity.SysEvaluation;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.SelectKey;
import org.apache.ibatis.annotations.Update;
import org.apache.ibatis.type.JdbcType;

public interface SysEvaluationMapper {
    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_evaluation
     *
     * @mbg.generated
     */
    @Delete({
        "delete from sys_evaluation",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int deleteByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_evaluation
     *
     * @mbg.generated
     */
    @Insert({
        "insert into sys_evaluation (order_id, star, ",
        "`comment`, repair_item_photo, ",
        "create_date)",
        "values (#{orderId,jdbcType=INTEGER}, #{star,jdbcType=INTEGER}, ",
        "#{comment,jdbcType=VARCHAR}, #{repairItemPhoto,jdbcType=VARCHAR}, ",
        "#{createDate,jdbcType=TIMESTAMP})"
    })
    @SelectKey(statement="SELECT LAST_INSERT_ID()", keyProperty="id", before=false, resultType=Integer.class)
    int insert(SysEvaluation record);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_evaluation
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, order_id, star, `comment`, repair_item_photo, create_date",
        "from sys_evaluation",
        "where id = #{id,jdbcType=INTEGER}"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER),
        @Result(column="star", property="star", jdbcType=JdbcType.INTEGER),
        @Result(column="comment", property="comment", jdbcType=JdbcType.VARCHAR),
        @Result(column="repair_item_photo", property="repairItemPhoto", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_date", property="createDate", jdbcType=JdbcType.TIMESTAMP)
    })
    SysEvaluation selectByPrimaryKey(Integer id);

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_evaluation
     *
     * @mbg.generated
     */
    @Select({
        "select",
        "id, order_id, star, `comment`, repair_item_photo, create_date",
        "from sys_evaluation"
    })
    @Results({
        @Result(column="id", property="id", jdbcType=JdbcType.INTEGER, id=true),
        @Result(column="order_id", property="orderId", jdbcType=JdbcType.INTEGER),
        @Result(column="star", property="star", jdbcType=JdbcType.INTEGER),
        @Result(column="comment", property="comment", jdbcType=JdbcType.VARCHAR),
        @Result(column="repair_item_photo", property="repairItemPhoto", jdbcType=JdbcType.VARCHAR),
        @Result(column="create_date", property="createDate", jdbcType=JdbcType.TIMESTAMP)
    })
    List<SysEvaluation> selectAll();

    /**
     * This method was generated by MyBatis Generator.
     * This method corresponds to the database table sys_evaluation
     *
     * @mbg.generated
     */
    @Update({
        "update sys_evaluation",
        "set order_id = #{orderId,jdbcType=INTEGER},",
          "star = #{star,jdbcType=INTEGER},",
          "`comment` = #{comment,jdbcType=VARCHAR},",
          "repair_item_photo = #{repairItemPhoto,jdbcType=VARCHAR},",
          "create_date = #{createDate,jdbcType=TIMESTAMP}",
        "where id = #{id,jdbcType=INTEGER}"
    })
    int updateByPrimaryKey(SysEvaluation record);
}